package file;

public class ForLoopDemo3 {
    public static void main(String[] args) {
        int[] clubCounts = {25,32,18,0,22};//0表示无效社团
        String[] clubNames = {"编程社","动漫社","志愿者社","无效社团","音乐社"};

        System.out.println("报名人数>=20的社团：");
        for (int i = 0;i < clubCounts.length; i++) {
            //遇到无效社团（人数0），停止循环
            if (clubCounts[i] == 0) {
                System.out.println("遇到无效社团，停止统计");
                break;
            }
                //遇到人数<20的社团，跳过当前循环（不输出）
                if (clubCounts[i] < 20) {
                    continue;
                }

                //输出符合条件的社团
                System.out.println(clubNames[i] +": " + clubCounts[i] + "人");
            }
        }
    }

